﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
/// <summary>
/// 打印任务项的内容格式
/// 对于文本打印模式,只支持字体颜色,倍宽,倍高,粗体,下划线
/// 对于图像打印牧师,只支持字体颜色
/// </summary>
namespace TmU220PrintHelperV2d0.Entity
{
    /// <summary>
    /// 打印内容的格式
    /// </summary>
    [XmlRoot("打印内容的格式")]
    [Serializable]
    public class PrintContentFormatV2d0
    {
        /// <summary>
        /// 字体颜色名称
        /// </summary>
        [XmlAttribute("字体颜色名称")]
        public string FontColor { get; set; }
        /// <summary>
        /// 文字尺寸 标注，倍宽，倍高，
        /// </summary>
        [XmlAttribute("是否倍高")]
        public bool IsDoubleHeight { get; set; }
        /// <summary>
        /// 是否倍宽
        /// </summary>
        [XmlAttribute("是否倍宽")]
        public bool IsDoubleWidth { get; set; }
        /// <summary>
        /// 是否倍宽
        /// </summary>
        [XmlAttribute("是否下划线")]
        public bool IsUnderLine { get; set; }
        /// <summary>
        /// 是否粗体
        /// </summary>
        [XmlAttribute("是否粗体")]
        public bool IsBold { get; set; }
        /// <summary>
        /// 文字位图的像素宽度 
        /// </summary>
        [XmlAttribute("文本图像宽度")]
        public int ImageWidth { get; set; }
        /// <summary>
        /// 文字位图的像素高度
        /// </summary>
        [XmlAttribute("文本图像高度")]
        public int ImageHeight { get; set; }

        /// <summary>
        /// 打印模式 Text:字符打印方式 Image:图像打印方式
        /// </summary>
        [XmlAttribute("打印模式")]
        public string PrintMode { get; set; }
        /// <summary>
        /// 对齐方式 "Left" "Center" "Right"
        /// </summary>
        [XmlAttribute("文本打印对齐方式")]
        public string Align { get; set; }
        public PrintContentFormatV2d0()
        {
            FontColor = "Black";// "Red"
            IsDoubleHeight = false;
            IsDoubleWidth = false;
            IsUnderLine = false;
            IsBold = false;
            ImageHeight =24;
            ImageWidth = 400;
            PrintMode = "Text";// "Image"
            Align = "Left";//"Middle"  "Right"
        }
        /// <summary>
        /// 根据打印模板行构建打印任务项的内容格式类
        /// </summary>
        /// <param name="printTempletElement"></param>
        public PrintContentFormatV2d0(PrintTempletRowV2d0 printTempletRow)
        {
            //默认都是左对齐
            Align = "Left";
            if (printTempletRow.TempletElementList.Count > 0)
            {
                FontColor = printTempletRow.TempletElementList[0].FontColor;
                IsBold = printTempletRow.TempletElementList[0].IsBold;
                IsDoubleHeight = printTempletRow.TempletElementList[0].IsDoubleHeight;
                IsDoubleWidth = printTempletRow.TempletElementList[0].IsDoubleWidth;
                IsUnderLine = printTempletRow.TempletElementList[0].IsUnderLine;
                PrintMode = printTempletRow.PrintMode;
            }
            else
            {
                FontColor = "Black";// "Red"
                IsDoubleHeight = false;
                IsDoubleWidth = false;
                IsUnderLine = false;
                IsBold = false;
                PrintMode = "Text";// "Image"
            }
            ImageHeight = 24;
            ImageWidth = 400;
        }
    }
}
